package com.commonly.dateformatting;

import java.text.SimpleDateFormat;
import java.util.Date;

public class FormattingSeconds {
	public static void main(String[] args) {
		 
	    //create Date object
	    Date date = new Date();
	   
	     //formatting seconds in s format like 1,2 etc.
	     String strDateFormat = "s";
	     SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
	     
	     System.out.println("seconds in s format : " + sdf.format(date));
	     
	     //formatting seconds in ss format like 01, 02 etc.
	     strDateFormat = "ss";
	     sdf = new SimpleDateFormat(strDateFormat);
	     System.out.println("seconds in ss format : " + sdf.format(date));
	  }
}
